package com.mdd.maduoduo.adapter;

import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.mdd.maduoduo.MyApplication;
import com.mdd.maduoduo.R;
import com.mdd.maduoduo.entity.UserEntity;
import com.mdd.maduoduo.utils.CommonAdapter;
import com.mdd.maduoduo.utils.CommonViewHolder;
import com.mdd.maduoduo.utils.GlideUtils;

import java.util.Arrays;

public class BottomDataAdapter extends CommonAdapter<UserEntity.DataDTO.FunctionConfigDtosDTO.ItemDtosDTO> {

    @Override
    protected int getLayoutResId(int viewType) {
        return R.layout.item_bottom_select;
    }

    @Override
    protected void bindData(@NonNull CommonViewHolder holder, UserEntity.DataDTO.FunctionConfigDtosDTO.ItemDtosDTO item, int position) {
        ImageView ivIcon = holder.getView(R.id.ivIcon);
        TextView tvTitle = holder.getView(R.id.tvTitle);
        TextView tvDesc = holder.getView(R.id.tvDesc);
        GlideUtils.getInstances().loadNormalImg(MyApplication.getContext(),ivIcon,item.url);
        tvTitle.setText(item.functionName);

        if(Arrays.asList(7,8).contains(item.jumpType)&&item.jumpUrl!=null&&!item.jumpUrl.equals("")){
            tvDesc.setVisibility(TextView.VISIBLE);
            tvDesc.setText(item.jumpUrl);
        }
    }
}
